package com.registration.service.util.config;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
    public class WebMvcConfig implements WebMvcConfigurer {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")  //允许所有请求映射
                    .allowedOrigins("*")    //允许8082跨域请求
                    .allowedHeaders("*")    //设置请求头
                    .allowedMethods("*")    //允许所有请求方式post,get,put,delete...
                    .maxAge(3600);  //设置有效时间
        }
}

